Skip to content

Instantly share code, notes, and snippets.

{"schemaVersion":1,"label":"Coverage","message":"75%","color":"hsl(75, 100%, 40%)"}
@v1kko
v1kko / REW_to_ACDf.py
Created October 26, 2022 12:20
Convert your REW filters (text format) to ACDf format to use with alsa
# Use as python3 REW_to_ACDf.py filter.txt
# where filter.txt is the text exported REW filters
# License GPLv3.0
# Copyright Victor Azizi 2022
import sys
import re
#Header
print("""pcm.!default {
type plug
#define SIZE 100000000
program test_openmp
real :: a(SIZE), b(SIZE), c(SIZE)
integer :: n
!$omp target teams
do n = 1, SIZE
c(n) = a(n) + b(n)
end do
@v1kko
v1kko / compile.rst
Last active February 2, 2022 12:46
code_10
# create hello_world_mod.mod and hello_world.o
> gfortran -c -fimplicit-none -Werror=implicit-interface hello_world.f90
# create main.o
> gfortran -c -fimplicit-none -Werror=implicit-interface main.f90
# link and create hello_world binary
> gfortran main.o hello_world.o -o hello_world
# Execute the program
> ./hello_world
@v1kko
v1kko / hello_world.f90
Created February 2, 2022 12:44
code_9
module hello_world_mod
contains
subroutine hello_world(name)
implicit none ! This should be present in all procedures
character(len=*) :: name
write(*,*) "Hello World: ", name
end subroutine
end module
@v1kko
v1kko / compile.rst
Last active February 2, 2022 12:48
code_8
# We will come back to the -fimplicit-none later
> gfortran -c -Werror=implicit-interface hello_world.f90
> gfortran -Werror=implicit-interface main.f90 -o hello_world
main.f90:3:31:

  3 |   call hello_world("You there")
    |                               1
Error: Type mismatch in argument ‘name’ at (1); passed CHARACTER(1) to INTEGER(4)
module hello_world_mod
contains
subroutine hello_world(name)
implicit none
write(*,*) "Hello World: ", name
end subroutine
end module
@v1kko
v1kko / main.f90
Created February 2, 2022 12:40
code_6
program main
interface
subroutine hello_world(name)
character(len=*) :: name
end subroutine
end interface
implicit none
call hello_world("You there")
end program
@v1kko
v1kko / main.f90
Last active February 2, 2022 12:40
code_5
program main
implicit none
call hello_world("You there")
contains
include 'hello_world.f90'
end program
@v1kko
v1kko / compile.rst
Last active February 2, 2022 12:35
code_4
> gfortran -fimplicit-none -Werror=implicit-interface main.f90 hello_world.f90 -o hello_world
 main.f90:2:31:

   2 |   call hello_world("You there")
     |                               1
 Error: Procedure ‘hello_world’ called with an implicit interface at (1) [-Werror=implicit-interface]