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

Djs/ C code cleanup: Update c code to reduce warnings #364

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7309687
numpy<2.0
deepanshs Aug 19, 2024
1ed871a
numpy<2.0_Re
deepanshs Aug 19, 2024
0906659
force gcc compiler for mac
deepanshs Aug 20, 2024
0671369
force gcc-14 compiler for mac
deepanshs Aug 20, 2024
7a40f9a
update mac setup
deepanshs Aug 20, 2024
ead7beb
O2 compile
deepanshs Aug 20, 2024
c5b2564
O2 compile
deepanshs Aug 20, 2024
a9cffc0
remove bit operation
deepanshs Aug 20, 2024
99f0562
.
deepanshs Aug 20, 2024
928210c
.
deepanshs Aug 20, 2024
7d9ad6e
test
deepanshs Aug 20, 2024
f063a70
.
deepanshs Aug 20, 2024
019d879
.
deepanshs Aug 20, 2024
a261571
.
deepanshs Aug 20, 2024
be1e3a7
.
deepanshs Aug 20, 2024
ff9c05c
Merge branch 'master' into djs/test_mac_github_action_issue
deepanshs Aug 25, 2024
ef95d97
apply compile warning suggestions
deepanshs Aug 25, 2024
1ffcebc
test
deepanshs Aug 25, 2024
76eed11
test
deepanshs Aug 26, 2024
24d087f
clean interpolation code
deepanshs Aug 27, 2024
a824c11
check c type consistency
deepanshs Aug 28, 2024
0c76788
cleanup
deepanshs Aug 28, 2024
6657592
update
deepanshs Aug 28, 2024
fc07586
change all uint to int
deepanshs Aug 28, 2024
2b22598
change all uint to int
deepanshs Aug 28, 2024
a47715e
fix
deepanshs Aug 29, 2024
1f939d4
cleanup
deepanshs Aug 29, 2024
d580018
Merge branch 'master' into djs/test_mac_github_action_issue
deepanshs Aug 29, 2024
d07eb3f
clean up
deepanshs Aug 30, 2024
a9c89a4
Merge branch 'master' into djs/test_mac_github_action_issue
deepanshs Aug 30, 2024
ddc98f6
Merge branch 'master' into djs/test_mac_github_action_issue
deepanshs Sep 2, 2024
65ea55f
Merge branch 'master' into djs/test_mac_github_action_issue
deepanshs Sep 8, 2024
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
10 changes: 8 additions & 2 deletions .github/workflows/continuous-integration-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install macos system dependencies
run: brew install openblas fftw
run: |
brew install openblas fftw
which clang
clang --version

- name: Install dependencies
run: |
Expand Down Expand Up @@ -125,7 +128,10 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install macos system dependencies
run: brew install openblas fftw
run: |
brew install openblas fftw
which clang
clang --version

- name: Install dependencies
run: |
Expand Down
16 changes: 12 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def check_if_header_exists(self, header):

def conda_setup_for_windows(self):
self.libraries += ["fftw3", "openblas"]
self.extra_compile_args = ["/DUSE_OPENBLAS"]
self.extra_compile_args += ["/DUSE_OPENBLAS"]

print(sys.version)
loc = dirname(sys.executable)
Expand All @@ -93,7 +93,7 @@ def conda_setup_for_unix(self):

self.include_dirs += self.check_valid_path([join(loc, "include")])
self.library_dirs += self.check_valid_path([join(loc, "lib")])
self.extra_compile_args = ["-O3", "-ffast-math", "-DUSE_OPENBLAS"]
self.extra_compile_args += ["-O3", "-ffast-math", "-DUSE_OPENBLAS"]
self.libraries += ["fftw3", "openblas"]

def on_exit_message(self, blas_lib, fftw_lib):
Expand Down Expand Up @@ -132,8 +132,8 @@ class WindowsSetup(Setup):
def __init__(self):
super().__init__()

self.extra_link_args += ["-Wl"]
self.extra_compile_args = ["-DFFTW_DLL"]
self.extra_link_args += []
self.extra_compile_args += ["-DFFTW_DLL", "/permissive-"]

# if use_mkl:
# self.mkl_blas_info()
Expand All @@ -148,6 +148,11 @@ def __init__(self):
"-O3",
"-ffast-math",
"-fcommon",
"-Wall",
"-Wextra",
"-Wconversion",
# "-Werror",
# "-pedantic",
# "-msse4.2",
# "-ftree-vectorize",
# "-fopt-info-vec-all",
Expand Down Expand Up @@ -185,6 +190,9 @@ def __init__(self):
# "-Rpass-analysis=loop-vectorize",
"-fvectorize",
"-fcommon",
"-Wall",
"-Wextra",
"-Wconversion",
]
self.extra_link_args += ["-lm"]

Expand Down
44 changes: 22 additions & 22 deletions src/c_lib/base/base_model.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,44 @@ cdef extern from "angular_momentum/wigner_matrix.h":

cdef extern from "schemes.h":
ctypedef struct MRS_averaging_scheme:
unsigned int total_orientations
int total_orientations

ctypedef struct MRS_fftw_scheme:
pass

MRS_averaging_scheme *MRS_create_averaging_scheme(
unsigned int integration_density,
int integration_density,
bool_t allow_4th_rank,
unsigned int n_gamma,
unsigned int integration_volume,
int n_gamma,
int integration_volume,
bool_t interpolation)

MRS_averaging_scheme *MRS_create_averaging_scheme_from_alpha_beta(
double *alpha,
double *beta,
double *weight,
unsigned int n_angles,
int n_angles,
bool_t allow_4th_rank,
unsigned int n_gamma,
unsigned int position_size,
int n_gamma,
int position_size,
int32_t *positions,
bool_t interpolation)

void MRS_free_averaging_scheme(MRS_averaging_scheme *scheme)
MRS_fftw_scheme *create_fftw_scheme(unsigned int total_orientations,
unsigned int number_of_sidebands)
MRS_fftw_scheme *create_fftw_scheme(int total_orientations,
int number_of_sidebands)
void MRS_free_fftw_scheme(MRS_fftw_scheme *fftw_scheme)


cdef extern from "mrsimulator.h":
ctypedef struct MRS_plan:
unsigned int number_of_sidebands
int number_of_sidebands
double rotor_frequency_in_Hz
double rotor_angle_in_rad

MRS_plan *MRS_create_plan(MRS_averaging_scheme *scheme, unsigned int number_of_sidebands,
MRS_plan *MRS_create_plan(MRS_averaging_scheme *scheme, int number_of_sidebands,
double rotor_frequency_in_Hz,
double rotor_angle_in_rad, double increment,
double rotor_angle_in_rad,
bool_t allow_4th_rank)
void MRS_free_plan(MRS_plan *plan)
void MRS_get_amplitudes_from_plan(MRS_plan *plan, bool_t refresh)
Expand Down Expand Up @@ -110,7 +110,7 @@ cdef extern from "method.h":
double increment # Increment of coordinates along the dimension.
double coordinates_offset # Start coordinate of the dimension.
MRS_event *events # Holds a list of events.
unsigned int n_events # The number of events.
int n_events # The number of events.

MRS_dimension *MRS_create_dimensions(
MRS_averaging_scheme *scheme,
Expand All @@ -124,8 +124,8 @@ cdef extern from "method.h":
double *rotor_frequency_in_Hz,
double *rotor_angle_in_rad,
int *n_events,
unsigned int n_dim,
unsigned int *number_of_sidebands)
int n_dim,
int *number_of_sidebands)

void MRS_free_dimension(MRS_dimension *dimensions, int n)

Expand All @@ -134,9 +134,9 @@ cdef extern from "simulation.h":
void mrsimulator_core(
# spectrum information and related amplitude
double *spec,
double spectral_start,
double spectral_increment,
int number_of_points,
# double spectral_start,
# double spectral_increment,
# int number_of_points,

site_struct *sites,
coupling_struct *couplings,
Expand All @@ -147,14 +147,14 @@ cdef extern from "simulation.h":
int quad_second_order, # Quad theory for second order,

# spin rate, spin angle and number spinning sidebands
unsigned int number_of_sidebands,
int number_of_sidebands,
double rotor_frequency_in_Hz,
double rotor_angle_in_rad,

float *transition_pathway, # Pointer to a list of transitions.
int integration_density,
unsigned int integration_volume, # 0-octant, 1-hemisphere, 2-sphere
unsigned int interpolate_type,
int integration_volume, # 0-octant, 1-hemisphere, 2-sphere
int interpolate_type,
unsigned char *freq_contrib,
double *affine_matrix,
)
Expand All @@ -170,7 +170,7 @@ cdef extern from "simulation.h":
MRS_dimension *dimensions, # the dimensions within method.
MRS_fftw_scheme *fftw_scheme, # the fftw scheme
MRS_averaging_scheme *scheme, # the powder averaging scheme
unsigned int interpolate_type,
int interpolate_type,
unsigned char *freq_contrib,
double *affine_matrix,
)
Expand Down
Loading
Loading