Skip to content
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

Dynamically set make's -j flag to use all available CPUs #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions compatibility_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import os
import subprocess
import multiprocessing
import sys

# File paths (globals)
Expand All @@ -21,6 +22,8 @@
port_num = 5432
exit_flag = False

nproc = multiprocessing.cpu_count();

# Load extension database
extn_files = os.listdir(current_working_dir + "/" + extn_info_dir)
extn_db = {}
Expand Down Expand Up @@ -79,8 +82,8 @@ def install_extn(extn_name, extn_entry, terminal_file):
return
elif install_type == "pgxs":
install_extn_dir = current_working_dir + "/" + ext_work_dir + "/" + extn_entry["folder_name"]
subprocess.run("make USE_PGXS=1 PG_CONFIG=" + pg_config_path + " -j8", shell=True, cwd=install_extn_dir, stdout=terminal_file, stderr=terminal_file)
subprocess.run("make USE_PGXS=1 PG_CONFIG=" + pg_config_path + " install -j8", shell=True, cwd=install_extn_dir, stdout=terminal_file, stderr=terminal_file)
subprocess.run("make USE_PGXS=1 PG_CONFIG=" + pg_config_path + f" -j{nproc}", shell=True, cwd=install_extn_dir, stdout=terminal_file, stderr=terminal_file)
subprocess.run("make USE_PGXS=1 PG_CONFIG=" + pg_config_path + f" install -j{nproc}", shell=True, cwd=install_extn_dir, stdout=terminal_file, stderr=terminal_file)
elif install_type == "shell_script":
# Copy shell script over to the installation directory and run it.
install_extn_dir = current_working_dir + "/" + ext_work_dir + "/" + extn_entry["folder_name"]
Expand Down Expand Up @@ -165,8 +168,8 @@ def install_postgres(postgres_config_options = []):

subprocess.run("./configure --prefix=" + prefix + " " + config_options_str, capture_output=True, shell=True, cwd=postgres_dir)
subprocess.run("make clean", capture_output=True, shell=True, cwd=postgres_dir)
subprocess.run("make world-bin -j8", capture_output=True, shell=True, cwd=postgres_dir)
subprocess.run("make install-world-bin -j8", capture_output=True, shell=True, cwd=postgres_dir)
subprocess.run(f"make world-bin -j{nproc}", capture_output=True, shell=True, cwd=postgres_dir)
subprocess.run(f"make install-world-bin -j{nproc}", capture_output=True, shell=True, cwd=postgres_dir)
print("Done installing Postgres " + postgres_version + "...")

def get_configure_options(extns_to_install):
Expand Down Expand Up @@ -763,4 +766,5 @@ def single_mode(file_extns_filename):
pairwise_parallel_mode(extn_list_filename)
elif mode == 'combinatorial':
### TODO: Support combinatorial mode
print("Combinatorial mode not supported yet!")
print("Combinatorial mode not supported yet!")