-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove intrinsics from allocate statements #803
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Comments
I found them all: src/simulation/m_global_parameters.fpp: @:ALLOCATE(Re_idx(1:2, 1:maxval(Re_size)))
src/simulation/m_rhs.fpp: @:ALLOCATE(Res(1:2, 1:maxval(Re_size)))
src/simulation/m_riemann_solvers.fpp: @:ALLOCATE(Res(1:2, 1:maxval(Re_size)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_send(0:-1 + buff_size*(sys_size + 2*nb*4)* & (m + 2*buff_size + 1)* & (n + 2*buff_size + 1)* & (p + 2*buff_size + 1)/ & (min(m, n, p) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_send(0:-1 + buff_size*(sys_size + 2*nb*4)* & (max(m, n) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_send(0:-1 + buff_size*sys_size* & (m + 2*buff_size + 1)* & (n + 2*buff_size + 1)* & (p + 2*buff_size + 1)/ & (min(m, n, p) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_send(0:-1 + buff_size*sys_size* & (max(m, n) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(c_divs_buff_send(0:-1 + buff_size*(num_dims+1)* & (m + 2*buff_size + 1)* & (n + 2*buff_size + 1)* & (p + 2*buff_size + 1)/ & (min(m, n, p) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(c_divs_buff_send(0:-1 + buff_size*(num_dims+1)* & (max(m, n) + 2*buff_size + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(ib_buff_send(0:-1 + gp_layers * & (m + 2*gp_layers + 1)* & (n + 2*gp_layers + 1)* & (p + 2*gp_layers + 1)/ & (min(m, n, p) + 2*gp_layers + 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(ib_buff_send(0:-1 + gp_layers* & (max(m, n) + 2*gp_layers + 1)))
src/simulation/m_viscous.fpp: @:ALLOCATE(Res_viscous(1:2, 1:maxval(Re_size)))
src/common/m_variables_conversion.fpp: @:ALLOCATE(Res(1:2, 1:maxval(Re_size))) Update, found these too: src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_recv(0:ubound(q_cons_buff_send, 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(q_cons_buff_recv(0:ubound(q_cons_buff_send, 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(c_divs_buff_recv(0:ubound(c_divs_buff_send, 1)))
src/simulation/m_mpi_proxy.fpp: @:ALLOCATE(ib_buff_recv(0:ubound(ib_buff_send, 1))) I used this Python script to find them #!/usr/bin/env python3
import os
import sys
# List of forbidden strings
forbidden_strings = ['max(', 'min(', 'maxval(', 'minval(']
# Define the function to process each file
def process_file(file_path):
try:
# Open the file for reading
with open(file_path, 'r') as myfile:
# Read all lines from the file and filter out empty lines
lines = [line.rstrip() for line in myfile if line.strip()] # Remove empty lines and trailing whitespace
# Prepare a list to hold processed lines
processed_lines = []
i = 0
while i < len(lines):
# Start with the current line
line = lines[i]
# Combine with the next line if the current line ends with '&'
while line.endswith('&') and i + 1 < len(lines):
i += 1
next_line = lines[i].lstrip() # Remove leading whitespace from the next line
line = line[:-1] + next_line # Remove '&' and append the next line
# Add the processed (combined) line to the list of processed lines
processed_lines.append(line)
i += 1
# Iterate through processed lines to check for conditions
for line in processed_lines:
# Check if the combined line starts with '@:ALLOCATE', ignoring leading whitespace
if line.lstrip().startswith('@:ALLOCATE'):
# Check if any forbidden string is in the combined line
if any(forbidden_string in line for forbidden_string in forbidden_strings):
print(f"{file_path}: {line.strip()}")
# sys.exit(1) # Exit with a nonzero code
except FileNotFoundError:
print(f"File not found: {file_path}")
sys.exit(1) # Exit with a nonzero code in case of error
# Define the function to iterate over all files in a directory and subdirectories
def process_directory(directory_path):
for root, _, files in os.walk(directory_path):
for file_name in files:
file_path = os.path.join(root, file_name)
# print('Checking: ', file_path)
process_file(file_path)
# Main execution: specify your directory path here
directory_path = 'src' # Replace with your target directory path
process_directory(directory_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Right now, we have intrinsics in allocate statements like this:
and
where we have
max
andmaxval
.The relevant quantities should be stored in variables, probably just in
m_global_parameters
(they can't go inm_constants
because they are only known at runtime).The text was updated successfully, but these errors were encountered: