Skip to content

Restructuring #2

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

Merged
merged 17 commits into from
Aug 14, 2025
Merged

Conversation

AdityaPandeyCN
Copy link

This PR restructures the project directory following our ROOT project. The benchmark folder and other files will be updated continuously to make it a proper package.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>

restructured the directory

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>

changed folder names

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>

restructuring the project

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as draft July 23, 2025 15:12
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review July 23, 2025 15:41
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as draft July 23, 2025 16:16
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review July 24, 2025 03:56
#include "utils.h"

#include "ramrecord.C"
#include "../inc/ttree/Utils.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the tools folder is where the executables are we need to find a better solution to this. The CMakeLists in tools should start depending on ttree and then it will need to automatically adjust the include paths so that you do not need to type ../inc.

@@ -1,8 +1,9 @@
// samtoramntuple.C
// SAM to RAM converteR

#include "RAMntuplerecord.C"
#include "RAMNTupleRecord.h"
#include "../src/rntuple/RAMNTupleRecord.cxx"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have to include the cxx file here?

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
CMakeLists.txt Outdated

add_library(ramtools_tree STATIC
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/ttree)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use target_include_directories. include_directories is not recommended unless there is a good reason for it.

CMakeLists.txt Outdated
Comment on lines 20 to 28
ROOT_GENERATE_DICTIONARY(G__ramtools_tree
RAMRecord.h
Utils.h
CigarOps.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/inc/ttree/LinkDef.h
MODULE ramtools_tree
)

add_library(ramtools_tree SHARED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not combining these two by using ROOT_STANDARD_LIBRARY_PACKAGE?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting errors after implementing this
CMake Error at /home/aditya/root-6.35-ntuple/share/root/cmake/RootMacros.cmake:1237 (install): install DIRECTORY given no DESTINATION! Call Stack (most recent call first): /home/aditya/root-6.35-ntuple/share/root/cmake/RootMacros.cmake:1428 (ROOT_INSTALL_HEADERS) CMakeLists.txt:22 (ROOT_STANDARD_LIBRARY_PACKAGE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message says it all, right? We need to pass some install directory of the component..

@@ -15,8 +15,8 @@
#include <TTreeIndex.h>
#include <TTreePerfStats.h>

#include "../inc/ttree/Utils.h"
#include "../inc/ttree/RAMRecord.h"
#include "Utils.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally these should be ttree/Utils.h to be able to know what's where...

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
};

// CIGAR operation codes (from BAM format)
#include "../ttree/CigarOps.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "../ttree/CigarOps.h"
#include "ttree/CigarOps.h"

const UChar_t RAM_CIGAR_P = 6;
const UChar_t RAM_CIGAR_EQUAL = 7;
const UChar_t RAM_CIGAR_X = 8;
#include "CigarOps.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "CigarOps.h"
#include "ttree/CigarOps.h"

@@ -0,0 +1,749 @@
//
// RAMNTupleRecord.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RAMNTupleRecord.cpp
// RAMNTupleRecord.cxx

const auto &entries = index_view(0);
fgIndex->SetEntries(entries);
} catch (...) {
// Field doesn't exist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's something we should rework maybe not part of this PR. We should not rely on exceptions to check if a field exists or not...

@@ -0,0 +1,37 @@
include(FetchContent)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 4 to 18
if(${tool_name} MATCHES "ntuple")
target_link_libraries(${tool_name} PRIVATE
ramtools_ntuple
ROOT::Core
ROOT::RIO
ROOT::ROOTNTuple
ROOT::ROOTNTupleUtil
)
else()
target_link_libraries(${tool_name} PRIVATE
ramtools_tree
ROOT::Core
ROOT::RIO
ROOT::Tree
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependencies should come from the outside as LIBRARY or something like that. We can use ROOT_EXECUTABLE.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN
Copy link
Author

I have tried to address the suggestions also apologies for the foolish errors I have made.

Copy link

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some basic linux CI?

CMakeLists.txt Outdated
@@ -1,44 +1,75 @@
cmake_minimum_required(VERSION 3.16)
project(ramtools VERSION 1.0.0 LANGUAGES C CXX)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why C here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually build was failing with empty CMAKE_C_COMPILER variable error so added C to check, now have removed passing it explicitly.

CMakeLists.txt Outdated
SOURCES ramrecord.C
HEADERS ramrecord.h
LIBRARIES ROOT::Core ROOT::RIO ROOT::Tree
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't ROOT_STANDARD_LIBRARY_PACKAGE set this properly up?

CMakeLists.txt Outdated
INSTALL_OPTIONS
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
add_library(ramtools_ntuple SHARED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is a separate library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was better to separate them but now will make it one.

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/ramtoolsTargets.cmake")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file needed?

Comment on lines 4 to 23
add_executable(CountEntriesTest CountEntriesTest.cxx)
target_link_libraries(CountEntriesTest PRIVATE
ramtools_tree
ramtools_ntuple
gtest
gtest_main
)
add_test(NAME CountEntriesTest COMMAND CountEntriesTest)
set_tests_properties(CountEntriesTest PROPERTIES
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tools
ENVIRONMENT "ROOT_INCLUDE_PATH=${CMAKE_SOURCE_DIR}/inc;LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}"
)

add_executable(RamviewCountsTest RamviewCountsTest.cxx)
target_link_libraries(RamviewCountsTest PRIVATE
ramtools_tree
ramtools_ntuple
gtest
gtest_main
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this into a cmake function? You can take a look at how it's done in clad...

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
CMakeLists.txt Outdated
set(CMAKE_INSTALL_LIBDIR lib)
set(CMAKE_INSTALL_INCLUDEDIR include)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/inc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the same as include_directories. Why do we need this to be set globally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still confused about this, not able to implement removing include directories.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need more information about that. Compiling which library fails if you remove that line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some changes, what do you think about it now?

Comment on lines 1 to 7
#include <gtest/gtest.h>
#include <TSystem.h>
#include <TFile.h>
#include <TTree.h>
#include <ROOT/RNTupleReader.hxx>
#include <iostream>
#include <string>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The includes are not ordered by component and then alphabetically.

}
};

TEST_F(RamviewCountsTest, CompareViewCountsForRegion) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN
Copy link
Author

Hello @vgvassilev Do you want me to address anything more for this PR?

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>

using ROOT_EXCEUTABLE

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Copy link

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. LGTM.

@vgvassilev vgvassilev merged commit c8739a5 into compiler-research:develop Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants