Skip to content

Instantly share code, notes, and snippets.

View czgdp1807's full-sized avatar
🏠
Working from home

ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) czgdp1807

🏠
Working from home
View GitHub Profile

Benchmark

Code

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import maximum_flow
import maxflow
import numpy as np, scipy, timeit, functools
from tabulate import tabulate

Codes

from ltypes import i32, f64

def test_dict():
    rollnumber2cpi: dict[i32, f64] = {0: 1.1}
    i: i32
    size: i32 = 100000000
    total: f64 = 0
@czgdp1807
czgdp1807 / lfortran_stdlib.md
Last active February 16, 2022 06:04
Current state: Compiling `stdlib` with `lfortran`
  1. Fetch numfocus-round2 for lfortran branch from here. Do a clean build of lfortran after checking out to numfocus-round2.
  2. Fetch master-lfortran for stdlib branch from here. Check out to master-lfortran.
  3. Run, FFLAGS=“--non-symtab-only” FC=lfortran cmake . inside stdlib.
  4. Run, make. You should be able to see the following logs,
[ 48%] Building Fortran object src/CMakeFiles/fortran_stdlib.dir/stdlib_system.F90.o
[ 49%] Linking Fortran static library libfortran_stdlib.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: libfortran_stdlib.a the table of contents is empty (no object file members in the library define global symbols)
[ 49%] Built target fortran_stdlib
(ray_dev) C:\Users\gagan\ray_project\ray>pytest -v -s --count=1 python\ray\tests\test_multinode_failures_2.py::test_actor_creation_node_failure
Test session starts (platform: win32, Python 3.8.11, pytest 5.4.3, pytest-sugar 0.9.4)
cachedir: .pytest_cache
rootdir: C:\Users\gagan\ray_project\ray\python
plugins: anyio-3.3.2, asyncio-0.15.1, lazy-fixture-0.6.3, repeat-0.9.1, rerunfailures-10.2, sugar-0.9.4, timeout-1.4.2
collecting ... 2021-11-02 10:14:14,937  INFO worker.py:838 -- Connecting to existing Ray cluster at address: 127.0.0.1:6379
(pid=None)
2021-11-02 10:14:36,953 WARNING worker.py:1239 -- A worker died or was killed while executing a task by an unexpected system error. To troubleshoot the problem, check the logs for the dead worker. RayTask ID: ffffffffffffffffae0bd0c1a64ad1765b178ede01000000 Worker ID: fa8e061419f1162b00067461c6bc66bfde0b6fb61388f2b95b7e50dc Node ID: f5036d1f1684f4ddfd568cd76dd63289447cb2781a8d28449d908ab8 Worker IP address: 127.0.0.1 Worker port: 53256 Worker PID: 11284
This file has been truncated, but you can view the full file.
Running from SciPy source directory.
Running scipy/linalg/_generate_pyx.py
Running scipy/special/_generate_pyx.py
Running scipy/stats/_generate_pyx.py
Processing scipy/cluster/_vq.pyx
Processing scipy/cluster/_optimal_leaf_ordering.pyx
Processing scipy/cluster/_hierarchy.pyx
Processing scipy/ndimage/src/_cytest.pyx
Processing scipy/ndimage/src/_ni_label.pyx
Processing scipy/linalg/cython_lapack.pyx

This report summarizes the work done in my GSoC 2021 project, Supporting Arrays and Allocatables in LFortran wth LFortran. A step by step development of the project is available at czgdp1807.github.io.

About Me

I am a final year Bachelor of Technology student at Indian Institute of Technology, Jodhpur in the department of Computer Science and Engineering.

Project Outline

This project aimed to add support for arrays and allocatables in LFortran. There were some miscellaneous goals as well, such as improving support for pointers and kinds and some bug fixes discovered along the way. The original plan of the project is listed as follows,

[  3%] Built target doctest[  7%] Built target lfortran_runtime_static
Scanning dependencies of target lfortran_lib
[  9%] Building CXX object src/lfortran/CMakeFiles/lfortran_lib.dir/parser/tokenizer.cpp.o
In file included from /home/czgdp1807ssd/lfortran_project/lfortran/src/lfortran/parser/tokenizer.h:5:0,
                 from /home/czgdp1807ssd/lfortran_project/lfortran/src/lfortran/parser/tokenizer.cpp:3:
/home/czgdp1807ssd/lfortran_project/lfortran/src/lfortran/parser/parser_stype.h:15:9: error: ‘AST’ was not declared in this scope
     Vec<AST::kind_item_t> kind;
         ^~~
/home/czgdp1807ssd/lfortran_project/lfortran/src/lfortran/parser/parser_stype.h:15:25: error: template argument 1 is invalid
import sys
def read():
return list(map(int, sys.stdin.readline().strip().split()))
def is_good(array, start, end, K):
if any([array[i] == 0 for i in range(start, end + 1)]):
return True
neg_nums = 0
for i in range(start, end + 1):
if array[i] < 0:
class Node(object):
__slots__ = ['key', 'next']
def __new__(cls, key):
obj = object.__new__(cls)
obj.key = key
obj.next = None
return obj